﻿using Microsoft.Extensions.Caching.Memory;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EmployeeCard.Common
{
    /// <summary>
    /// 实现缓存接口
    /// </summary>
    public class MemoryCaching : ICaching
    {
        private IMemoryCache _memoryCache;
        public MemoryCaching(IMemoryCache memoryCache)
        {
            _memoryCache = memoryCache;
        }
        public object Get(string cacheKey)
        {
            return _memoryCache.Get(cacheKey);
        }

        public void Set(string cacheKey, object cacheValue)
        {
            _memoryCache.Set(cacheKey, cacheValue, TimeSpan.FromSeconds(7200));
        }
    }
}
